package com.example.last.dao;

import com.example.last.entity.Params;
import com.example.last.entity.Type;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TypeDao {
    List<Type> findBySearch(@Param("params") Params params);

    @Insert("Insert into type (type_name, description) values (#{type_name},#{description})")
    void add(Type type);

    @Update("Update type set type_name = #{type_name},description = #{description} where id = #{id}")
    void update(Type type);

    @Delete(("delete from type where id = #{id} "))
    void delete(Integer id);

    @Select("select * from type ")
    List<Type> findAll();
    @Select("select * from type where id = #{id}")
    Type selectByPrimaryKey(Integer id);

}
